package com.mq.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Deprecated
//@Configuration
public class FanoutConfig {
    /**
     * 创建交换机
     * @return
     */
//    @Bean
    public FanoutExchange fanoutExchange(){
        return new FanoutExchange("hmall.fanout");
//        return ExchangeBuilder.fanoutExchange("hmall.fanout").build();
    }

    /**
     * 创建第一个队列
     * @return
     */
//    @Bean
    public Queue  fanoutQueue1(){
        return new Queue("fanout.queue1");
    }

    /**
     * 创建第二个队列
     * @return
     */
//    @Bean
    public Queue  fanoutQueue2(){
        return new Queue("fanout.queue2");
    }

    /**
     * 绑定交换机和队列
     * @return
     */
//    @Bean
    public Binding bindingQueue1(){
        return BindingBuilder.bind(fanoutQueue1()).to(fanoutExchange());
    }
//    @Bean
    public Binding bindingQueue2(){
        return BindingBuilder.bind(fanoutQueue2()).to(fanoutExchange());
    }
}
